home *** CD-ROM | disk | FTP | other *** search
/ Leonardo the Inventor / Leonardo The Inventor (93026)(Broderbund)(Riverdeep)(2004).iso / LEOWINMV / FORTGAME.DIR / 00217_Script_217 < prev    next >
Text File  |  1996-03-20  |  13KB  |  477 lines

  1. -- FLEE THE FORTRESS --
  2. -- Lingo by Ephraim Tabackman--
  3. -- Revision June 15, 1994 --
  4. -- Fixed problems with cursors --
  5.  
  6. on begin
  7.   goFirstLevel
  8.   --goSecondlevel
  9.   --goThirdlevel
  10. end begin
  11.  
  12. on startMovie
  13.   set the cursor of sprite 1 = -1
  14.   -- recordSpots      -- òòòòò
  15.   -- resetGame
  16. end startMovie
  17.  
  18. on stopMovie
  19.   noPuppets
  20.   when keyDown then nothing
  21.   --global theList    -- òòòòò
  22.   --put theList       -- òòòòò
  23. end stopMovie
  24.  
  25. on noPuppets
  26.   repeat with S = 1 to 24
  27.     puppetSprite S, false
  28.   end repeat
  29. end noPuppets
  30.  
  31. on emptyCastNumber
  32.   return the number of cast "itemEmpty"
  33. end emptyCastNumber
  34.  
  35. -- CURSORS:
  36. -- 128: Backward
  37. -- 129: Left
  38. -- 130: Right
  39. -- 131: Forward
  40. -- 132: Point
  41. -- 133: Hand
  42. -- 134: Magnify
  43. -- 135: Fist
  44.  
  45. on resetGame
  46.   noPuppets
  47.   
  48.   put field "Default Doors Data" into field "Doors Data"
  49.   
  50.   global BGSoundFile
  51.   set BGSoundFile = the pathName & "FG_BG.AIF"
  52.   
  53.   --  set BGSoundFile = "LEONARDO:LEOWINMV:FG_BG.AIF"
  54.   
  55.   global hallBackwardSprite, hallForwardSprite,openDoorSprite,enterDoorSprite,closeDoorSprite,roomBackwardSprite
  56.   set hallBackwardSprite = 8
  57.   set hallForwardSprite = 9
  58.   set openDoorSprite = 11
  59.   set enterDoorSprite = 11
  60.   set closeDoorSprite = 12
  61.   set roomBackwardSprite = 11
  62.   global hallBackwardCursor, hallForwardCursor,openDoorCursor,enterDoorCursor,closeDoorCursor,roomBackwardCursor,grabObjectCursor
  63.   set hallBackwardCursor = [the number of cast "129Cursor", the number of cast "129Mask"]
  64.   set hallForwardCursor = [the number of cast "130Cursor", the number of cast "130Mask"]
  65.   set openDoorCursor = [the number of cast "135Cursor", the number of cast "135Mask"]
  66.   set enterDoorCursor = [the number of cast "131Cursor", the number of cast "131Mask"]
  67.   set closeDoorCursor = [the number of cast "133Cursor", the number of cast "133Mask"]
  68.   set roomBackwardCursor = [the number of cast "128Cursor", the number of cast "128Mask"]
  69.   set grabObjectCursor = [the number of cast "133Cursor", the number of cast "133Mask"]
  70.   
  71.   global PlayViolaCursor
  72.   set PlayViolaCursor = [the number of cast "132Cursor", the number of cast "132Mask"]
  73.   
  74.   global sceneSprite, roomNumberSprite
  75.   set sceneSprite = 3
  76.   set roomNumberSprite = 4
  77.   
  78.   global mapSprite, mapMarkerSprite
  79.   set mapSprite = 13
  80.   set mapMarkerSprite = 14
  81.   puppetSprite mapMarkerSprite, true
  82.   global mapScale
  83.   set mapScale = 4
  84.   
  85.   resetInventory
  86.   
  87.   global objectChannel1, objectChannel2
  88.   set objectChannel1 = 5
  89.   set objectChannel2 = 6
  90.   
  91.   ------------------------------------- OBJECT FLAGS
  92.   
  93.   global BackwardNoteTaken, BackwardNoteSprite
  94.   set BackwardNoteTaken = false
  95.   set BackwardNoteSprite = objectChannel1
  96.   
  97.   global MusicClue1Taken, MusicClue2Taken, MusicClueSprite
  98.   set MusicClue1Taken = false
  99.   set MusicClue2Taken = false
  100.   set MusicClueSprite = objectChannel1
  101.   
  102.   global Snorkel1Taken, Snorkel1Sprite
  103.   set Snorkel1Taken = false
  104.   set Snorkel1Sprite = objectChannel1
  105.   
  106.   global Key1Taken, Key2Taken, Key3Taken, Key4Taken, KeySprite
  107.   set Key1Taken = false
  108.   set Key2Taken = false
  109.   set Key3Taken = false
  110.   set Key4Taken = false
  111.   set KeySprite = objectChannel1
  112.   
  113.   global drawBridgeDoorOpen, drawBridgeDoorSprite
  114.   set drawBridgeDoorOpen = false
  115.   set drawBridgeDoorSprite = objectChannel1
  116.   global drawBridgeHandleSprite
  117.   set drawBridgeHandleSprite = objectChannel1
  118.   
  119.   global TrunkOpen, trunkSprite
  120.   set trunkOpen = false
  121.   set trunkSprite = ObjectChannel1
  122.   
  123.   ----------------------------------------------------
  124.   
  125.   global NumPositionsA, NumPositionsB, NumPositionsC, NumPositionsR
  126.   global LastDoorA, LastDoorB, LastDoorC
  127.   set NumPositionsA = 16
  128.   set NumPositionsB = 32
  129.   set NumPositionsC = 48
  130.   set NumPositionsR = 24
  131.   set LastDoorA = 4
  132.   set LastDoorB = 12
  133.   set LastDoorC = 24
  134.   
  135.   begin
  136.   
  137. end resetGame
  138.  
  139. on resetInventory
  140.   global item1Sprite, item2Sprite, item3Sprite
  141.   set item1Sprite = 15
  142.   set item2Sprite = 16
  143.   set item3Sprite = 17
  144.   
  145.   puppetSprite item1Sprite, true
  146.   puppetSprite item2Sprite, true
  147.   puppetSprite item3Sprite, true
  148.   
  149.   global grabObjectCursor
  150.   set the castNum of sprite item1Sprite to emptyCastNumber()
  151.   set the castNum of sprite item2Sprite to emptyCastNumber()
  152.   set the castNum of sprite item3Sprite to emptyCastNumber()
  153.   
  154.   resetSpriteCursor item1Sprite
  155.   resetSpriteCursor item2Sprite
  156.   resetSpriteCursor item3Sprite
  157.   
  158.   global item1Name, item2Name, item3Name
  159.   set item1Name = empty
  160.   set item2Name = empty
  161.   set item3Name = empty
  162. end resetInventory
  163.  
  164. on restoreInventory
  165.   global item1Sprite, item2Sprite, item3Sprite
  166.   global item1Name, item2Name, item3Name
  167.   puppetSprite item1Sprite, true
  168.   puppetSprite item2Sprite, true
  169.   puppetSprite item3Sprite, true
  170.   
  171.   set the castNum of sprite item1Sprite to the number of cast item1Name
  172.   set the castNum of sprite item2Sprite to the number of cast item2Name
  173.   set the castNum of sprite item3Sprite to the number of cast item3Name
  174. end restoreInventory
  175.  
  176. on resetCursors
  177.   global hallBackwardSprite, hallForwardSprite,openDoorSprite,closeDoorSprite,roomBackwardSprite
  178.   set the cursor of sprite hallBackwardSprite = -1
  179.   set the cursor of sprite hallBackwardSprite = 0
  180.   set the cursor of sprite hallForwardSprite = -1
  181.   set the cursor of sprite hallForwardSprite = 0
  182.   set the cursor of sprite openDoorSprite = -1
  183.   set the cursor of sprite openDoorSprite = 0
  184.   set the cursor of sprite closeDoorSprite = -1
  185.   set the cursor of sprite closeDoorSprite = 0
  186.   set the cursor of sprite roomBackwardSprite = -1
  187.   set the cursor of sprite roomBackwardSprite = 0
  188. end resetCursors
  189.  
  190. on setGrabObjectCursor WhichSprite
  191.   global grabObjectCursor
  192.   set the cursor of sprite WhichSprite = grabObjectCursor
  193. end setGrabObjectCursor 
  194.  
  195. on resetSpriteCursor whichSprite
  196.   set the cursor of sprite WhichSprite = -1
  197. end resetSpriteCursor
  198.  
  199. on goFirstLevel
  200.   global currentList, CurrentListLine
  201.   set currentList = "A"
  202.   set CurrentListLine = 2
  203.   moveInHall 0 --  go to the start position
  204.   when keyDown then checkKeyCode
  205. end goFirstLevel
  206.  
  207. on goSecondLevel
  208.   resetInventory
  209.   global currentList, CurrentListLine
  210.   set currentList = "B"
  211.   set CurrentListLine = 10
  212.   moveInHall 0 --  go to the start position
  213.   when keyDown then checkKeyCode
  214. end goSecondLevel
  215.  
  216. on goThirdLevel
  217.   resetInventory
  218.   global currentList, CurrentListLine
  219.   set currentList = "C"
  220.   set CurrentListLine = 1
  221.   moveInHall 0 --  go to the start position
  222.   when keyDown then checkKeyCode
  223. end goThirdLevel
  224.  
  225. on checkKeyCode
  226.   put the keyCode into userKeyCode
  227.   if userKeyCode = 123 then
  228.     moveBackward
  229.     dontPassEvent
  230.   else if userKeyCode = 124 then 
  231.     moveForward
  232.     dontPassEvent
  233.   else if userKeyCode = 125 then 
  234.     moveBackward
  235.     dontPassEvent
  236.   else if userKeyCode = 126 then 
  237.     moveForward
  238.     dontPassEvent
  239.   end if
  240. end checkKeyCode
  241.  
  242. on clickNearDoor
  243.   global currentList, CurrentListLine
  244.   clickDoor getNearRoomNumber()
  245. end clickNearDoor
  246.  
  247. on ClickToCloseDoor
  248.   CloseDoor getNearRoomNumber()
  249.   global closeDoorSprite
  250.   set the cursor of sprite closeDoorSprite = -1
  251.   puppetSound "Slam"
  252.   moveInHall 0
  253.   waitSound
  254. end ClickToCloseDoor
  255.  
  256. on moveForward
  257.   global currentList, currentListLine
  258.   if currentList = "R" then
  259.     BumpSound
  260.   else    
  261.     moveInHall +1
  262.   end if
  263. end moveForward
  264.  
  265. on moveBackward
  266.   global currentList
  267.   if currentList = "R" then
  268.     exitRoom
  269.   else
  270.     moveInHall -1
  271.   end if
  272. end moveBackward
  273.  
  274. on getDoorOpenStatus whichRoom
  275.   return item 3 of line whichRoom of the text of cast "Doors Data"
  276. end getDoorLockStatus
  277.  
  278. on clickDoor whichRoom
  279.   put the text of cast "Doors Data" into DoorsData
  280.   put line whichRoom of DoorsData into thisDoor
  281.   put item 1 of thisDoor into Lock_Status
  282.   put item 2 of thisDoor into KeyName
  283.   put item 3 of thisDoor into Open_Status
  284.   
  285.   if Open_Status = "Open" then
  286.     enterRoom whichRoom
  287.     exit
  288.   end if
  289.   
  290.   if Lock_Status = "Unlocked" then
  291.     OpenDoor whichRoom
  292.     exit
  293.   end if
  294.   
  295.   if Lock_Status = "Locked" then
  296.     rPlaySoundAndWait "Locked"
  297.   end if
  298.   
  299. end clickDoor
  300.  
  301. on setDoorOpenStatus whichDoor, openOrClosed
  302.   put openOrClosed into item 3 of line whichDoor of field "Doors Data"
  303. end setDoorOpenStatus
  304.  
  305. on setDoorLockedStatus whichDoor, lockedOrUnlocked
  306.   put lockedOrUnlocked into item 1 of line whichDoor of field "Doors Data"
  307. end setDoorLockedStatus
  308.  
  309. on unlockDoor whichDoor
  310.   setDoorLockedStatus whichDoor, "Unlocked"
  311. end unlockDoor
  312.  
  313. on OpenDoor whichRoom
  314.   setDoorOpenStatus whichRoom, "Open"
  315.   global roomNumberSprite
  316.   puppetSprite roomNumberSprite, true
  317.   go frame "OpenDoor"
  318.   global enterDoorSprite, enterDoorCursor, closeDoorSprite, closeDoorCursor
  319.   set the cursor of sprite enterDoorSprite = enterDoorCursor
  320.   set the cursor of sprite closeDoorSprite = closeDoorCursor
  321. end OpenDoor
  322.  
  323. on CloseDoor whichRoom
  324.   setDoorOpenStatus whichRoom, "Closed"
  325.   global roomNumberSprite
  326.   puppetSprite roomNumberSprite, false
  327. end CloseDoor
  328.  
  329. on doorAlreadyClosed
  330.   go frame "DoorOpen"
  331.   global enterDoorSprite, enterDoorCursor, closeDoorSprite, closeDoorCursor
  332.   set the cursor of sprite enterDoorSprite = enterDoorCursor
  333.   set the cursor of sprite closeDoorSprite = closeDoorCursor
  334. end doorAlreadyClosed
  335.  
  336. on enterRoom whichRoom
  337.   global currentList, CurrentListLine
  338.   global lastHallList, lastHallListLine
  339.   set lastHallList = currentList
  340.   set lastHallListLine = CurrentListLine
  341.   set currentList = "R"
  342.   set currentListLine = whichRoom
  343.   puppetTransition 9, 2, 8, true -- center out square
  344.   
  345.   setUpRoom
  346. end enterRoom
  347.  
  348. on setUpRoom
  349.   global currentList, CurrentListLine
  350.   resetCursors
  351.   
  352.   setUpObjects currentList&¤tListLine
  353.   
  354.   global roomBackwardSprite, roomBackwardCursor
  355.   set the cursor of sprite roomBackwardSprite = roomBackwardCursor
  356.   
  357.   UpdatePosition
  358. end setUpRoom
  359.  
  360. on exitRoom
  361.   global currentList, CurrentListLine
  362.   global lastHallList, lastHallListLine
  363.   
  364.   set currentList = lastHallList
  365.   set currentListLine = lastHallListLine
  366.   puppetTransition 10, 2, 8, true -- edges in square
  367.   
  368.   moveInHall 0
  369. end exitRoom
  370.  
  371. on moveInHall amount
  372.   global currentList, CurrentListLine
  373.   global NumPositionsA, NumPositionsB, NumPositionsC
  374.   global LastDoorA, LastDoorB, LastDoorC
  375.   
  376.   if      currentList = "A" then put NumPositionsA into posMax
  377.   else if currentList = "B" then put NumPositionsB into posMax
  378.   else if currentList = "C" then put NumPositionsC into posMax
  379.   
  380.   set nextLine = CurrentListLine + amount
  381.   
  382.   if nextLine > posMax then set nextLine = 1
  383.   else if nextLine < 1 then set nextLine = posMax
  384.   
  385.   set CurrentListLine = nextLine
  386.   
  387.   resetCursors
  388.   global hallBackwardSprite, hallForwardSprite
  389.   global hallBackwardCursor, hallForwardCursor
  390.   
  391.   set the cursor of sprite hallBackwardSprite = hallBackwardCursor
  392.   set the cursor of sprite hallForwardSprite = hallForwardCursor
  393.   
  394.   UpdatePosition
  395.   
  396. end moveInHall
  397.  
  398. on UpdatePosition
  399.   global currentList, CurrentListLine
  400.   GoToPosition getFrameFromListLine(currentList, CurrentListLine)
  401. end GoToCurrentPosition
  402.  
  403. on GoToPosition whichPos
  404.   
  405.   global openDoorSprite, openDoorCursor
  406.   
  407.   if not (whichPos contains "-" or whichPos contains "+" or whichPos contains "D" or whichPos contains "R") then go frame "Hall"
  408.   else if (whichPos contains "D") and (getDoorOpenStatus (getNearRoomNumber()) = "Open") then doorAlreadyClosed
  409.   else
  410.     go frame whichPos
  411.     if (whichPos contains "D") then set the cursor of sprite openDoorSprite = openDoorCursor
  412.   end if
  413.   put whichPos into field "Position"
  414.   
  415.   updateMap
  416.   
  417.   global BGSoundFile
  418.   if whichPos = "R 21" then sound stop 2
  419.   else
  420.     if not soundBusy(2) then sound playFile 2, BGSoundFile
  421.   end if
  422.   
  423.   updateStage
  424. end GoToPosition
  425.  
  426. on getNearRoomNumber
  427.   global currentList, CurrentListLine
  428.   return integer(value(word 2 of getFrameFromListLine(currentList, CurrentListLine)))
  429. end getNearRoomNumber
  430.  
  431. on getFarRoomNumber
  432.   global currentList, CurrentListLine
  433.   return (word 3 of getFrameFromListLine(currentList, CurrentListLine))
  434. end getFarRoomNumber
  435.  
  436. on getFrameFromListLine aList, aListLine
  437.   put value(aListLine) into aListLine
  438.   return item 1 of line aListLine of field ("List"&aList)
  439. end getFrameFromListline
  440.  
  441. on getMapCoordsFromListLine aList, aListLine
  442.   put value(aListLine) into aListLine
  443.   return item 2 of line aListLine of field ("List"&aList)
  444. end getMapCoordsFromListLine
  445.  
  446. on updateMap
  447.   global currentList, CurrentListLine
  448.   global mapMarkerSprite, mapSprite, mapScale
  449.   set newCoord = getMapCoordsFromListLine (currentList, CurrentListLine)
  450.   
  451.   set newV = integer ((word 2 of newCoord * mapScale) + the locV of sprite mapSprite)
  452.   set newH = integer ((word 1 of newCoord * mapScale) + the locH of sprite mapSprite)
  453.   
  454.   set the locV of sprite mapMarkerSprite = newV
  455.   set the locH of sprite mapMarkerSprite = newH
  456. end updateMap
  457.  
  458.  
  459. --------------------------------------------------------------------------
  460.  
  461.  
  462. on hideSprite whichSprite, bUpdate
  463.   puppetSprite whichSprite, true
  464.   set the locV of sprite whichSprite = -3000
  465.   if bUpdate then updateStage
  466. end hideSprite
  467.  
  468.  
  469. on WaitTicks howMany
  470.   put the ticks into startTicks
  471.   repeat while the ticks < startTicks + howMany
  472.   end repeat  
  473. end WaitTicks
  474.  
  475.  
  476.  
  477.